package Demo3;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-21
 * Time: 10:55
 */
public class Main{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        Ticket a = new WalkupTicket(in.nextInt());
        System.out.println(a.toString());
        Ticket b = new AdvanceTicket(in.nextInt(), in.nextInt());
        System.out.println(b.toString());
        Ticket c = new StudentAdvanceTicket(in.nextInt(), in.nextInt(), in.nextInt());
        System.out.println(c.toString());
    }
}

/* 请在这里填写答案 */
abstract class Ticket {
    private int number;

    public Ticket(int number) {
        this.number = number;
    }
    abstract int getPrice();

    @Override
    public String toString() {
        return "Number:"+number;
    }
}
class WalkupTicket extends Ticket {

    public WalkupTicket(int number) {
        super(number);
    }

    @Override
    int getPrice() {
        return 50;
    }

    @Override
    public String toString() {
        return super.toString()+"Price:"+getPrice();
    }
}
class AdvanceTicket extends Ticket {
    private int leadTime;

    public AdvanceTicket(int number, int leadTime) {
        super(number);
        this.leadTime = leadTime;
    }

    @Override
    int getPrice() {
        if (leadTime>10){
            return 30;
        } else {
            return 40;
        }
    }

    public int getLeadTime() {
        return leadTime;
    }
    public String toString() {
        return super.toString()+"Price:"+getPrice();
    }
}
class StudentAdvanceTicket extends AdvanceTicket {
    private int height;

    public StudentAdvanceTicket(int number, int leadTime, int height) {
        super(number, leadTime);
        this.height = height;
    }

    @Override
    int getPrice() {
        if (height>120){
            if (getLeadTime()>10){
                return 20;
            }
            else {
                return 30;
            }
        }
        else if (height<=120){
            if (getLeadTime()>10){
                return 10;
            }
            else {
                return 15;
            }
        }
        return 0;
    }

    public String toString() {
        return super.toString();
    }
}